<%@page import="org.springframework.security.authentication.encoding.Md5PasswordEncoder"%>
<%@ page language="java" contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%boolean bool = false;%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Admin page</title>
<link rel="stylesheet" type="text/css" href="../resources/style.css">
</head>
<body>
	<form method="post" action="./admin">
	<table border="2" cellpadding="10" align="center">
		<tr align="center" bgcolor="FFCC99">
			<th width="100">Username</th>
			<th width="100">Enabled </th>
			<th width="100">Role	</th>
		</tr>
		<c:forEach var="user" items="${usersList}">
		<tr <%if(bool == true) {%>
			bgcolor="CCCCCC"
			<%bool=false; } else {%>
			bgcolor="FFFFFF"
			<%bool=true; }%> 
			>
			<td>
				${user.username}
				<br>
				<c:if test="${user.username != principalName}">
					<a href="admin?username=${user.username}&action=delete"><small>delete</small></a> 
				</c:if>
			</td>
			<td align="center">
				${user.enabled}
				<br>
				<c:if test="${user.username != principalName}">
					<a href="admin?username=${user.username}&action=exable"><small>change</small></a>
				</c:if>
			</td>
			<td>
				${user.role}
				<br>
				<c:if test="${user.username != principalName}">
					<a href="admin?username=${user.username}&action=exrole"><small>change</small></a>
				</c:if>
			</td>
		</tr>
		</c:forEach>
	</table>
	</form>
	
	<br>
	<a href="../web/admin?username=${principal.username}&action=none">Refresh page</a>
	<br>
	
	<br>
	<hr width="100" align="left">
	<br>
	
	<a href="../">home</a>
</body>
</html>